/*window.onload = function() {
  var luckbtn = document.getElementsByClassName("btn")[0];
  luckbtn.addEventListener("click", function(e) {
    var str = Math.round(Math.random() * 1000).toString();
     
    if (str.length == 1) {
      str = "00" + str;
    }
    if (str.length == 2) {
      str = "0" + str;
    }
    console.log(str);
  
    var luckstr = str;
    var arr = luckstr.split("");
    var delay1 = 2,
      delay2 = delay1 + arr[0] * 0.2,
      delay3 = delay2 + arr[1] * 0.2;
    var first = document.getElementsByClassName("first")[0];
    first.style.cssText = "animation: circle1 2s ease-out";
    first.style.transition = "all " + arr[0] * 0.15 + "s ease-out";
    first.style.transitionDelay = "2s";
    first.style.marginTop = -98 * arr[0] + "px";
  
  
    var second = document.getElementsByClassName("second")[0];
    second.style.cssText = "animation: circle2 3s ease-out";
    second.style.transition = "all " + arr[1] * 0.15 + "s ease-out";
    second.style.transitionDelay = "3s";
    second.style.marginTop = -98 * arr[1] + "px";
  
    var third = document.getElementsByClassName("third")[0];
    third.style.cssText = "animation: circle3 4s ease-out";
    third.style.transition = "all " + arr[2] * 0.15 + "s ease-out";
    third.style.transitionDelay = "4s";
    third.style.marginTop = -98 * arr[2] + "px";
  
  });
  var resetbtn = document.getElementsByClassName("btn")[1];
  resetbtn.addEventListener("click", function(e) {
    var first = document.getElementsByClassName("first")[0];
    first.style.cssText = "";
    first.style.transform = "";
  
    var second = document.getElementsByClassName("second")[0];
    second.style.cssText = "";
    second.style.transform = "";
  
    var third = document.getElementsByClassName("third")[0];
    third.style.cssText = "";
    third.style.transform = "";
  
  });
}*/


function newLN1()
{
  x = document.getElementById("1");
  x.innerHTML = String(Math.floor(Math.random() * 10));
  t1 = setTimeout(newLN1, 50);  
}
function newLN2()
{
  x = document.getElementById("2");
  x.innerHTML = String(Math.floor(Math.random() * 10));
  t2 = setTimeout(newLN2, 50);
}
function newLN3()
{
  x = document.getElementById("3");
  x.innerHTML = String(Math.floor(Math.random() * 10));
  t3 = setTimeout(newLN3, 50);
}

function start()
{
  
    newLN1();
    newLN2();
    newLN3();
  
}

function reset()
{
  x = document.getElementById("1");
  x.innerHTML = "0";
  x = document.getElementById("2");
  x.innerHTML = "0";
  x = document.getElementById("3");
  x.innerHTML = "0";
}

var number = String();
function stop1()
{
  clearTimeout(t1);
  x = document.getElementById("1");
  //y = document.getElementById("t1");
  //y.innerHTML = x.innerHTML;
  number += x.innerHTML;
}


function stop2()
{
  clearTimeout(t2);
  x = document.getElementById("2");
  //y = document.getElementById("t2");
  //y.innerHTML = x.innerHTML;
  number +=  x.innerHTML;
}

function stop3()
{
  clearTimeout(t3);
  x = document.getElementById("3");
  number += x.innerHTML;
  
  var c = document.getElementById("t");
  
  var x1 = c.insertRow(0);
  x1.innerHTML = number;
  
  
  
  number = "";
}



function stop()
{
  
  setTimeout(stop1, 500);
  setTimeout(stop2, 1500);
  setTimeout(stop3, 3000);
  
}





